{ "cells": [ { "cell_type": "markdown", "id": "c79330fa", "metadata": {}, "source": [ "# Changing Genes" ] }, { "cell_type": "raw", "id": "c4080915", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ " Import :class:`~ia.gaius.agent_client.AgentClient` from module :py:mod:`ia.gaius.agent_client`" ] }, { "cell_type": "code", "execution_count": 1, "id": "a5063878", "metadata": {}, "outputs": [], "source": [ "from ia.gaius.agent_client import AgentClient" ] }, { "cell_type": "code", "execution_count": 2, "id": "f5170111", "metadata": {}, "outputs": [], "source": [ "agent_info = {'name': '',\n", " 'domain': 'gaius-api',\n", " 'secure': False,\n", " 'api_key': 'ABCD-1234'}" ] }, { "cell_type": "code", "execution_count": 3, "id": "b4358862", "metadata": {}, "outputs": [], "source": [ "agent = AgentClient(agent_info)" ] }, { "cell_type": "code", "execution_count": 4, "id": "cfafe1bc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'connection': 'okay', 'agent': 'simple'}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "agent.connect()" ] }, { "cell_type": "code", "execution_count": 5, "id": "24716f91", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'AUTOLEARN': False,\n", " 'PREDICT': True,\n", " 'SLEEPING': False,\n", " 'emotives': {},\n", " 'last_learned_model_name': '',\n", " 'models_kb': '{KB| objects: 0}',\n", " 'name': 'P1',\n", " 'size_WM': 0,\n", " 'target': '',\n", " 'time': 0,\n", " 'vectors_kb': '{KB| objects: 0}'}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "agent.show_status()" ] }, { "cell_type": "code", "execution_count": 6, "id": "d4be3778", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'genes': {'always_update_frequencies': False,\n", " 'auto_learn_algorithm': 'basic',\n", " 'auto_learn_metric': 'WM_size',\n", " 'classifier': 'CVC',\n", " 'max_predictions': 100,\n", " 'near_vector_count': 3,\n", " 'persistence': 5,\n", " 'predict_on_nth_event': 1,\n", " 'quiescence': 3,\n", " 'recall_threshold': 0.1,\n", " 'smoothness': 3,\n", " 'sort_metric': 'potential'}}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "agent.get_all_genes(nodes=['P1'])" ] }, { "cell_type": "raw", "id": "b6650be2", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ " \n", "We can change genes using the :func:`~ia.gaius.agent_client.AgentClient.change_genes` api call \n", " " ] }, { "cell_type": "markdown", "id": "23adf0ac", "metadata": {}, "source": [ " " ] }, { "cell_type": "code", "execution_count": 7, "id": "931c4415", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'updated-genes'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "agent.change_genes({'recall_threshold': 0.2}, nodes=['P1'])" ] }, { "cell_type": "code", "execution_count": 8, "id": "d5bd4bee", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'genes': {'always_update_frequencies': False,\n", " 'auto_learn_algorithm': 'basic',\n", " 'auto_learn_metric': 'WM_size',\n", " 'classifier': 'CVC',\n", " 'max_predictions': 100,\n", " 'near_vector_count': 3,\n", " 'persistence': 5,\n", " 'predict_on_nth_event': 1,\n", " 'quiescence': 3,\n", " 'recall_threshold': 0.2,\n", " 'smoothness': 3,\n", " 'sort_metric': 'potential'}}" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "agent.get_all_genes(nodes=['P1'])" ] }, { "cell_type": "code", "execution_count": null, "id": "1e3bf9bd", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "celltoolbar": "Raw Cell Format", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 5 }